# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-pytest-socket
pkgver=0.7.0
pkgrel=1
pkgdesc="Pytest Plugin to disable socket calls during tests"
url="https://github.com/miketheman/pytest-socket"
arch="noarch"
license="MIT"
depends="py3-pytest"
makedepends="
	poetry
	py3-gpep517
	py3-wheel
	"
checkdepends="py3-pytest-httpbin"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/miketheman/pytest-socket/archive/refs/tags/$pkgver.tar.gz"
options="net" # Required for tests
builddir="$srcdir/pytest-socket-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# tests/test_async.py requires py3-httpx which is not available on ppc64le
	.testenv/bin/python3 -m pytest -k 'not test_starlette and not test_asynctest and not test_single_cli_arg_connect_disabled_hostname_resolved' \
		--ignore tests/test_async.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
fe8888819fef0f192f88a7509fe153b992c12a1fd1d56ae69c844a592fc403e3b5b13c4c3c4be89c8bf114f18d84fb6d6e8a8e3604d7fe454d090272689136f1  py3-pytest-socket-0.7.0.tar.gz
"
